from froModuleDrivers.homeDeviceDriver import HomeDeviceDriver # 引用家居设备控制器驱动模块
from froModuleDrivers.nioManager import NioManager # 引用驱动管理模块
import time

# 驱动初始化
driver_fan = HomeDeviceDriver("192.168.50.145", 4001)
manager = NioManager(driver_fan)
manager.run()

# 风扇相关的3个API
# 1、获取拓展风扇的状态，风扇打开返回True，关闭或者没有连接返回False
print(driver_fan.isRoomFanOpen(3))

# 2、打开风扇
driver_fan.openRoomFan(3)
time.sleep(3)

# 3、关闭风扇
driver_fan.closeRoomFan(3)
time.sleep(1)

# 等待指令执行完毕后系统退出
manager.shutdownGracefully()